<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'资源添加', styles:'bootstrap,font-awesome,animate,style,dtvalidate,layer,chosen,layui'}){%>
    <style type="text/css">
        body{padding-top:10px;}
    </style>
    <%}%>
</head>
<body>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="col-sm-offset-1 col-sm-10" style="margin-left: -10px;width: 100%;">
                <button type="button" class="return-btn btn btn-w-m btn-primary">返回</button>
                <div style="border-color: #e7eaec;border-image: none;border-style: solid solid none;border-width: 4px 0px;padding-bottom: 15px;margin-top: 10px;" ></div>
            </div>
        </div>
    </div>
</div>
<!-- START 内容部分 -->
<div class="container" >
    <form class="form-horizontal" id="info-form" method="post" autocomplete="off" style="margin: auto">
        <input type="hidden" name="id" id="id" value="${refusedTax.id}">
        <div class="form-group">
            <label class="col-sm-2 control-label text-right">海关单编号</label>
            <div class="col-sm-6">
                <input type="text" id="refusedNo" name="refusedNo" value="${refusedTax.refusedNo}" readonly class="form-control"  />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-sm-2">退税柜号</label>
            <div class="col-sm-6">
                <input type="text" id="refusedPlanNo" name="refusedPlanNo" value="${refusedTax.refusedPlanNo}" readonly class="form-control"  />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-sm-2">渠道</label>
            <div class="col-sm-6">
                <input type="text" id="refusedChannel" name="refusedChannel" value="${refusedTax.refusedChannel}" readonly class="form-control"  />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label text-right">实际报关金额</label>
            <div class="col-sm-6">
                <input type="text" id="refusedCreateMoney" value="${refusedTax.refusedCreateMoney}" name="refusedCreateMoney" onkeyup="value=value.replace(/[^\d\.]/g,'')" class="form-control"  />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label text-right">实际清关金额</label>
            <div class="col-sm-6">
                <input type="text" id="refusedCustomMoney"  value="${refusedTax.refusedCustomMoney}"  name="refusedCustomMoney" onkeyup="value=value.replace(/[^\d\.]/g,'')" class="form-control"  />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label text-right">报关单附件</label>
            <div class="col-sm-6">
                <button  class="layui-btn layui-btn-sm import-btn" style="margin-left: -2px" type="button" id="import-btn"  name="import-btn">
                    <i class="layui-icon"></i>导入报关单附件
                </button>
                <input type="hidden" id="refusedOrderFile" value="${refusedTax.refusedOrderFile}" name="refusedOrderFile">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label text-right">清关附件</label>
            <div class="col-sm-6">
                <button  class="layui-btn layui-btn-sm " style="margin-left: -2px" type="button" id="import-btn-file"  name="import-btn-file">
                    <i class="layui-icon"></i>导入清关附件
                </button>
                <input type="hidden" id="refusedMoneyFile"  value="${refusedTax.refusedMoneyFile}" name="refusedMoneyFile">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="save-btn btn btn-primary">
                    <i class="fa fa-save"></i> 保存
                </button>
            </div>
        </div>
    </form>
</div>
<!-- END 内容部分 -->

<!-- START 公共脚本 -->
<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,dtvalidate,dtvalidate-lang-zh_cn,laydate,chosen,chosen-demo,layer,layui,upload'}){}%>
<!-- END 公共脚本 -->
<script>
    laydate.render({
        elem: '#createPlanPlaceDate',
        type: 'date',
        format: 'yyyy-MM-dd'
    });
    layui.use('upload', function(){
        var upload = layui.upload;
        upload.render({
            elem: '#import-btn', //绑定元素,
            accept:'file',
            url: '/sea/physical/refusedTax/import/', //上传接口
            data:{},
            before:function () {
                layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
            }
            ,done: function(data){
                if( data.ok ){
                    layer.msg(data.msg,{icon: 1,time: 1500},function(){
                        //刷新页面
                        $("#refusedOrderFile").val(data.data);
                        layer.closeAll();
                    });
                }else{
                    layer.msg(data.msg,{icon: 0,time: 5000},function () {
                        layer.closeAll();
                    });

                }
            }
            ,error: function(){
                //请求异常回调
                layer.closeAll();
            }
        });
    });

    layui.use('upload', function(){
        var upload = layui.upload;
        upload.render({
            elem: '#import-btn-file', //绑定元素,
            accept:'file',
            url: '/sea/physical/refusedTax/import/', //上传接口
            data:{},
            before:function () {
                layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
            }
            ,done: function(data){
                if( data.ok ){
                    layer.msg(data.msg,{icon: 1,time: 1500},function(){
                        //刷新页面
                        $("#refusedMoneyFile").val(data.data);
                        // parent.$relatedTable.bootstrapTable('refresh');
                         layer.closeAll();
                    });
                }else{
                    layer.msg(data.msg,{icon: 0,time: 5000},function () {
                        layer.closeAll();
                    });

                }
            }
            ,error: function(){
                //请求异常回调
                layer.closeAll();
            }
        });
    });
    var cvalidator;
    $(function(){

        formSelects.render('refusedPlanNo');
        //初始化验证器
        cvalidator = $.fn.dlshouwen.validator.init($('#info-form'));
        //提交表单
        $('.save-btn').on('click',function(){
            var index=layer.load();
            //数据提交
            $.post('/sea/physical/refusedTax/usave.do',$('#info-form').serialize(),function(data){
                if( data.ok ){
                    layer.close(index);
                    parent.layer.msg(data.msg,{icon:1,time:1500,shade: [0.8, '#393D49']}, function(){
                        parent.$relatedTable.bootstrapTable('refresh');
                        parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭弹窗
                    });
                }else{
                    parent.layer.msg(data.msg,{icon: 0,time:1500,shade: [0.8, '#393D49']});
                    layer.close(index);
                }
            });
        });

        //返回
        $('.return-btn').on('click',function(){
            parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭弹窗
        });


    });


</script>
</body>
</html>